home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / dwtext.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  3.8 KB  |  148 lines

  1. /* Copyright (C) 1996, Russell Lang.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19.  
  20. // $Id: dwtext.h,v 1.2 2000/09/19 19:00:10 lpd Exp $
  21. // Text Window class
  22.  
  23.  
  24. #ifdef _WINDOWS
  25. #define _Windows
  26. #endif
  27.  
  28.  
  29. /* ================================== */
  30. /* text window class */
  31.  
  32.  
  33. class TextWindow {
  34.     HINSTANCE hInstance;    /* required */
  35.     LPSTR Title;        /* required */
  36.     HICON hIcon;        /* optional */
  37.  
  38.     BYTE FAR *ScreenBuffer;
  39.     POINT ScreenSize;        /* optional */
  40.     char *DragPre;        /* optional */
  41.     char *DragPost;        /* optional */
  42.     int nCmdShow;        /* optional */
  43.     HWND hwnd;
  44.  
  45.     BYTE FAR *KeyBuf;
  46.     BYTE FAR *KeyBufIn;
  47.     BYTE FAR *KeyBufOut;
  48.     unsigned int KeyBufSize;
  49.     BOOL quitnow;
  50.  
  51.     BOOL bFocus;
  52.     BOOL bGetCh;
  53.     char *fontname;        // font name
  54.  
  55.     int fontsize;        // font size in pts
  56.  
  57.     HFONT hfont;
  58.     int CharAscent;
  59.  
  60.     int CaretHeight;
  61.     int CursorFlag;
  62.     POINT CursorPos;
  63.     POINT ClientSize;
  64.     POINT CharSize;
  65.     POINT ScrollPos;
  66.     POINT ScrollMax;
  67.  
  68.     void error(char *message);
  69.     void new_line(void);
  70.     void update_text(int count);
  71.     void drag_drop(HDROP hdrop);
  72.     void copy_to_clipboard(void);
  73.  
  74.          public:
  75.     // constructor
  76.          TextWindow(void);
  77.  
  78.     // destructor
  79.         ~TextWindow(void);
  80.  
  81.     // register window class
  82.     int register_class(HINSTANCE hinst, HICON hicon);
  83.  
  84.     // test if a key has been pressed
  85.     // return TRUE if key hit
  86.     // return FALSE if no key
  87.     int kbhit(void);
  88.  
  89.     // Get a character from the keyboard, waiting if necessary
  90.     int getch(void);
  91.  
  92.     // Get a line from the keyboard
  93.     // store line in buf, with no more than len characters
  94.     // including null character
  95.     // return number of characters read
  96.     int gets(LPSTR buf, int len);
  97.  
  98.     // Get a line from the keyboard
  99.     // store line in buf, with no more than len characters
  100.     // line is not null terminated
  101.     // return number of characters read
  102.     int read_line(LPSTR buf, int len);
  103.  
  104.     // Put a character to the window
  105.     int putch(int ch);
  106.  
  107.     // Write cnt character from buf to the window
  108.     void write_buf(LPSTR buf, int cnt);
  109.  
  110.     // Put a string to the window
  111.     void puts(LPSTR str);
  112.  
  113.     // Scroll window to make cursor visible
  114.     void to_cursor(void);
  115.  
  116.     // Create and show window with given name and min/max/normal state
  117.     // return 0 on success, non-zero on error
  118.     int create(LPSTR title, int cmdShow);
  119.  
  120.     // Destroy window
  121.     int destroy(void);
  122.  
  123.     // Set window font and size
  124.     // a must choose monospaced 
  125.     void font(const char *fontname, int fontsize);
  126.  
  127.     // Set screen size in characters
  128.     void size(int width, int height);
  129.  
  130.     // Set pre drag and post drag strings
  131.     // If a file is dropped on the window, the following will
  132.     // be poked into the keyboard buffer: 
  133.     //   the pre_drag string
  134.     //   the file name
  135.     //   the post_drag string
  136.     void drag(const char *pre_drag, const char *post_drag);
  137.  
  138.     // member window procedure
  139.     LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
  140.  
  141.     // provide access to window handle
  142.     HWND get_handle(void) {
  143.     return hwnd;
  144.     };
  145. };
  146.  
  147. /* ================================== */
  148.